<?php

// +----------------------------------------------------------------------
// |店铺管理控制器
// +----------------------------------------------------------------------
namespace app\admin\controller;

use app\BaseController;
use think\facade\View;
use think\facade\Cache;
use think\facade\Db;
use app\common\system\ShopsService;


class Shops extends BaseController
{
    public function index(){
         //查询商品分类
        $field = 'catepubid,pubnameCn';//要显示的字段
        $where[]=['valid','=',1];//查询条件 
        $where[]=['parecatepubId','=',0];//查询条件      
        $categoinfo = $this->infos(Db::name('catego'),$field,$where); 
        if(request()->isPost()){
            $param = request()->param();          
            $result = ShopsService::getlist($param, $categoinfo);   
            success($result);
        }else{  
              view::assign('categoinfo',json_encode($categoinfo,JSON_UNESCAPED_UNICODE));
            return view::fetch();
        }
    }

     // 店铺新增
     public function  create(){
        if(request()->isPost()){
            $param = request()->post();
            $data= ShopsService::create($param);        
            success($data);
        }
     }
     
      // 店铺修改状态
      public function  update_status(){
        if(request()->isPost()){
            $param = request()->post();
            $data= ShopsService::update_status($param);        
            success($data);
        }
      }

}